#include "Device/mt9v034/MT9V034_RT1064.h"

void MT9V034_RT1064::Init()
{
	IIC_Init(iic);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0x06, 0x0206);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0xAF, 0x0000);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0x0B, 0x0200); // 512 曝光时间
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0x0D, 0x033A);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0x0E, 0x003A);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0x0F, 0x0101);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0x1B, 0x0001);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0x1C, 0x0303);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0x2C, 0x0003);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0x35, 0x0020); // GAIN 图像增益
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0x36, 0x0020);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0x3A, 0x001A);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0x47, 0x0081);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0x48, 0x00EC);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0x72, 0x0010);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0xCE, 0x0206);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0xCF, 0x01BB);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0xD0, 0x01D9);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0xD2, 0x0200);
	SCCB_Device_Write16bit(iic, CHIP_ADDR, 0xFE, 0xDEAD);//锁住寄存器
	

	CSI_TransferSubmitEmptyBuffer(base, handle, (uint32_t)BOARD_CSI_Buffer[0]);
	CSI_TransferSubmitEmptyBuffer(base, handle, (uint32_t)BOARD_CSI_Buffer[1]);
	CSI_TransferStart(base, handle);
}
